import { ref } from 'vue'
export const mixin = {
  methods: {
    mapStatusName(status) {
      if (Number(status) == 0) {
        return '待提交'
      } else if (Number(status) == 1) {
        return '待审核'
      } else if (Number(status) == 2) {
        return '审核通过'
      } else if (Number(status) == 3) {
        return '审核退回'
      } else {
        return '-'
      }
    },
    handleDetail(defaultIndex, scope, type = 'detail') {
      let status =
        scope.row[getActiveName(defaultIndex) + 'Status']
      let path = ''
      console.log(defaultIndex)
      if (defaultIndex == 0) {
        path =
          '/wisdomConstruction/fileManagement/preliminaryProcedure/form'
      } else if (defaultIndex == 1) {
        path =
          '/wisdomConstruction/fileManagement/projectDesign/form'
      } else if (defaultIndex == 2) {
        path =
          '/wisdomConstruction/fileManagement/projectBidding/form'
      } else if (defaultIndex == 3) {
        path =
          '/wisdomConstruction/fileManagement/projectImply/form'
      } else if (defaultIndex == 4) {
        path =
          '/wisdomConstruction/fileManagement/projectSettlement/form'
      }
      console.log(defaultIndex, path)
      this.$router.push({
        path,
        query: {
          defaultIndex,
          pkid: scope.row.pkid,
          status,
          type
        }
        //   params:{baseData:scope.row}
      })
    }
    // handleShenhe(scoped, stage) {
    //   this.$refs.shenhe.changeDialog(scoped, stage)
    // }
  }
}

export function getActiveName(stage) {
  if (Number(stage) == 0) {
    return 'qqsx'
  } else if (Number(stage) == 1) {
    return 'xmsj'
  } else if (Number(stage) == 2) {
    return 'xmzb'
  } else if (Number(stage) == 3) {
    return 'xmss'
  } else if (Number(stage) == 4) {
    return 'xmjs'
  } else {
    return 'qqsx'
  }
}

export function showStatus(status) {
  console.log(status)
  if (Number(status) == 0) {
    return ref('正在填写')
  } else if (Number(status) == 1) {
    return ref('待审核')
  } else if (Number(status) == 2) {
    return ref('审核通过')
  } else if (Number(status) == 3) {
    return ref('审核退回')
  } else {
    return ref('-')
  }
}
